/*
An instance of this class represents the current state of an object.
On one hand, an object can be located in several zones or areas at the same time with different
membership values (one for every area in which the object could be located in). On the other hand,
the object can belong to different classes at the same time instant.
*/

import java.util.Vector;
class ObjectEvent{
	
    protected String id_object;	
    protected int current_frame;
    protected Vector<Zone> areas;
    protected Vector<MembershipTA> roles;
    
	
    
    public ObjectEvent(String id){
	this.id_object = id;
	areas = new Vector();
	roles = new Vector();
    }
    public ObjectEvent(String id, int frame){
	this.id_object = id;
	this.current_frame = frame;
	areas = new Vector();
	roles = new Vector();
    }

    
    
    public String getId(){return this.id_object;}
    public Vector<Zone> getZones(){return this.areas;}
    public int getCurrentFrame(){return this.current_frame;}
    public Vector<MembershipTA> getRoles(){return this.roles;}
    
    public void addZone(Zone z){this.areas.addElement(z);}
    public void addRole(MembershipTA moc){this.roles.addElement(moc);}
    
    public void setCurrentFrame(String frame){
	this.current_frame = Integer.parseInt(frame);
    }
    public void setCurrentFrame(int frame){
	this.current_frame = frame;
    }
    public String toString(){
	String text = "OBJ: " + this.id_object + " in Frame: "+this.current_frame+"\n";
	for(int i =0; i< areas.size(); i++){
	    Zone z = (Zone) areas.elementAt(i);
	    text += z.name + "("+z.membership_value+")\n";
	}//for
	text += "\nROLES:\n";
	for(int i =0; i< roles.size(); i++){
	    MembershipTA moc = (MembershipTA) roles.elementAt(i);
	    text += moc.class_name + "("+moc.membership_value+")\n";
	}//for
	return text;
    }//toString
}//end class
